#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int checkData(int* p)
{
    char tmp = 0;
	int i =0;
	for(i=0;i<5;i++)
	{
	    tmp |= 1<<p[i];
	}
	return tmp == 0X3E;
}
void DiveBank(int arr[],int n)
{
	int i = 0;
    if(n>=5)
	{
        if((arr[1]==2) + (arr[0]==3)==1 &&
		   (arr[1]==2) + (arr[4]==4)==1 &&
	       (arr[2]==1) + (arr[3]==2)==1 &&
		   (arr[2]==5) + (arr[3]==3)==1 &&
		   (arr[4]==4) + (arr[0]==1)==1 &&
		   checkData(arr))
		 {
		    for(i=0;i<5;i++)
			  {
			      printf("%d ",arr[i]);
			  }
	     }	
		return;
	}
	for(arr[n]=1;arr[n]<=5;arr[n]++)
	{
	    DiveBank(arr,n+1);
	}
}
int main ()
{
	int arr[5];
	DiveBank(arr,0);
	return 0;
}